-
Notifications
You must be signed in to change notification settings - Fork 318
feat: prune old, inactive paths #3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat-multipath
Are you sure you want to change the base?
Conversation
I don't want to remove the metrics plumbing, but it is currently unused. So emit a single metric for now. Need to do a proper metrics review later, we need more metrics than this.
Turns out we don't do anything with those. We only use this to decide to check if we need to holepunch again. This calls trigger_holepunching for every connection event which will wake it up too much, because we only really need to do it for the connection we are using to holepunch. But the state tracking is easier like this and the cost probably not too high.
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3666/docs/iroh/ Last updated: 2025-11-23T13:39:20Z |
it's something, if not much
not sure how bad or good this is yet, but it compiles
|
@flub can I merge into |
…` method, and called it whenever new paths are added
…unched this connection
matheus23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the previous comments addressed, this is good to go from my side.
Sorry that I effectively blocked this so long that we ended up with a bigger merge conflict :S
Description
Prune paths that are not actively being used, never have been holepunched, are not about to be dialed, or old.
Notes and Questions
The logic of gathering all of the relevant information is in the
fn prune_ip_pathsfunction, not in theself.prune_ip_pathsmethod onEndpointActorState. Separating these out made it easier to test.Used AI to help write tests & reduce allocations when working through the paths.
keep_pathis where we can play around with what exactly we want to keep, based on thePathState, if we want to get more strict or particular as we learn more.I added a
PathState::holepunchedfield that says whether or not that path was ever hole punched.I added an
Instantto thePathState::sent_pingfield, so we can ensure that we don't prune paths that are currently attempting to holepunch, giving a very generous 30 seconds before deciding that the holepunch didn't work.Right now we:
This means:
Also, we only do prune this if there are more that 20 inactive paths open.
I've added
prune_ip_pathsevery time we call insert theEndpointActorState::paths.